package de.gwtprime.shared.util;


public class NumFormat
{
	/**
	 * Helper function to format the double input into the representation 0.00
	 * 
	 */
	public static String formatDouble(Double d)
	{
		if (d == null)
			return "###";
		
		int temRes =d.intValue();
		String result = d.toString();
		
		// If decimals are 00, don't show them
		if (result.endsWith(".00"))
			result = result.substring(0, result.length() - 3);
		else if (result.endsWith(".0"))
			result = result.substring(0, result.length() - 2);
		
		return String.valueOf(temRes);
	}
}
